<!DOCTYPE html>
<!--使用的时候需要注意的事项-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<link rel="stylesheet" href="css/layui.css" media="all">
<script src="js/layui.js" charset="utf-8"></script>
<head>
    <meta name="renderer" content="webkit">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>欢迎来到后台管理系统</h1>
<table class="layui-hide" id="test"></table>

<script>
    layui.use('table', function () {
        var table = layui.table;
        table.render({
            elem: '#test'
            , url: 'http://localhost:80/xgk/selectByPage'
            , cols: [[
                {field: 'id', width: 80, title: 'ID', sort: true}
                , {field: 'zydm', width: 150, title: '专业代码'}
                , {field: 'zymc', width: 180, title: '专业名称', sort: true}
                , {field: 'xlcc', width: 80, title: '学历层次'}
                , {field: 'ml', title: '门类', width: 125}
                , {field: 'xk', width: 120, title: '学科', sort: true}
                , {field: 'zyjs', width: 380, title: '专业介绍', sort: true}
            ]],
            //加上这个解决我们的返回类型的错误
            parseData: function (res) {
                return {
                    "code": 0,
                    "msg": "",
                    "count": res.length,
                    "data": res
                }
            }
            , page: true
        });
    });
</script>
</body>

</html>
